package drytools.site.beans;


import com.icesoft.faces.context.effects.*;

import java.util.HashMap;
import java.util.Collection;

import javax.faces.component.UICommand;
import javax.faces.component.UIOutput;
import javax.faces.webapp.UIComponentTag;


public class EffectsProvider  {
    // map of possible effects.
    private HashMap<String, Effect> effects;

    public EffectsProvider() {
    	init();
    }

    /**
     * Initialized all the effects object.  Effects have to be in either
     * Session or Request scope so that only the indended users sees them.
     */
    protected void init() {
        // build a list of our know effects
        effects = new HashMap<String, Effect>();
       UICommand h;
       UIOutput o;
        // fade appear effect 
        EffectQueue fadeAppear = new EffectQueue("effectFadeAppear");
        fadeAppear.add(new Fade());
        fadeAppear.add(new Appear());
        effects.put("effectFadeAppear",fadeAppear);

        effects.put("effectHighlight",new Highlight("#fda505"));
        
         // pulsate
        Pulsate pulsate = new Pulsate();
        pulsate.setDuration(1.0f);
        effects.put("effectPulsate",pulsate);

        // effect move and move back.
//        EffectQueue move = new EffectQueue("effectMove");
//        move.add(new Move(25, 25, "relative"));
//        move.add(new Move(-25, -25, "relative"));
//        effects.put("effectMove",
//                new EffectWrapper(
//                        MessageBundleLoader.getMessage("page.effect.move.title"),
//                        move));

        // scale effect
//        EffectQueue scale = new EffectQueue("effectScale");
//        scale.add(new Scale(50));
//        scale.add(new Scale(200));
//        effects.put("effectScale",
//                new EffectWrapper(
//                        MessageBundleLoader.getMessage("page.effect.scale.title"),
//                        scale));

        // puff effect
        EffectQueue puff = new EffectQueue("effectPuff");
        puff.add(new Puff());
        puff.add(new Appear());
        effects.put("effectPuff",puff);

        // Blind effect
        EffectQueue blind = new EffectQueue("effectBlind");
        blind.add(new BlindUp());
        blind.add(new BlindDown());
        effects.put("effectBlind",blind);

        // drop out effect
        EffectQueue dropOut = new EffectQueue("effectDropOut");
        dropOut.add(new DropOut());
        dropOut.add(new Appear());
        effects.put("effectDropOut",dropOut);

        // shake effect
        effects.put("effectShake",new Shake());

        // Slide effect
        EffectQueue slide = new EffectQueue("effectSlide");
        slide.add(new SlideUp());
        slide.add(new SlideDown());
        effects.put("effectSlide",slide);

        // Shrink effect
        EffectQueue shrink = new EffectQueue("effectShrink");
        shrink.add(new Shrink());
        shrink.add(new Appear());
        effects.put("effectShrink",shrink);
    }

    public HashMap<String, Effect> getEffects() {
    	init();
        return effects;
    }

    /**
     * Gets a list of EffectWrapper objects.
     * @return collection of EffectWrapper
     */
    public Collection<String> getEffectKeys() {
        return effects.keySet();
    }
}